<?php
require 'UnionFind.php';
$size = 10000;
$uf = new UnionFind($size);
$m = 500;
for ($i = 0; $i < $m; $i++) {
    $a = mt_rand(0, $size - 1);
    $b = mt_rand(0, $size - 1);
    $uf->unionElements($a, $b);
}
var_dump($uf->isConnected(50,100)); //判断 50 和 100是否相连

$size = 10000;
$uf = new UnionFind($size);
$m = 11000;
for ($i = 0; $i < $m; $i++) {
    $a = mt_rand(0, $size - 1);
    $b = mt_rand(0, $size - 1);
    $uf->unionElements($a, $b);
}
var_dump($uf->isConnected(50,100)); //判断 50 和 100是否相连
